#This code creates Tables A10-A12

#clear memory
rm(list=ls())

#set random number seed
set.seed(123456789)

#load necessary R packages
library(prais)

#set working directory
setwd("")  

#load-in Data
dailydata<-read.csv("DailyResponseTS.csv")
dailydata<-subset(dailydata,!is.na(LnL7allrequests))
dailydata$time<-seq(1:nrow(dailydata))

############
#Table A.10#
############

# Estimate
pw <- prais_winsten(deny ~ seclaw+civicsight, data = dailydata, index = "time")
summary(pw)

# Estimate
pw <- prais_winsten(deny ~ seclaw+civicsight+L7matconf_govcit+L7protest_citgov+legelecperiod, data = dailydata, index = "time")
summary(pw)

# Estimate
pw <- prais_winsten(deny ~ seclaw+civicsight+L7matconf_govcit+L7protest_citgov+legelecperiod+lnL7cases+LnL7allrequests, data = dailydata, index ="time")
summary(pw)

############
#Table A.11#
############

# Estimate
pw <- prais_winsten(log(deny+1) ~ seclaw+civicsight, data = dailydata, index = "time")
summary(pw)

# Estimate
pw <- prais_winsten(log(deny+1) ~ seclaw+civicsight+L7matconf_govcit+L7protest_citgov+legelecperiod, data = dailydata, index = "time")
summary(pw)

# Estimate
pw <- prais_winsten(log(deny+1) ~ seclaw+civicsight+L7matconf_govcit+L7protest_citgov+legelecperiod+lnL7cases+LnL7allrequests, data = dailydata, index ="time")
summary(pw)

############
#Table A.12#
############

# Estimate
pw <- prais_winsten(bad2good ~ seclaw+civicsight, data = dailydata, index = "time")
summary(pw)

# Estimate
pw <- prais_winsten(bad2good ~ seclaw+civicsight+L7matconf_govcit+L7protest_citgov+legelecperiod, data = dailydata, index = "time")
summary(pw)

# Estimate
pw <- prais_winsten(bad2good ~ seclaw+civicsight+L7matconf_govcit+L7protest_citgov+legelecperiod+lnL7cases+LnL7allrequests, data = dailydata, index ="time")
summary(pw)

